function [ theta ] = intersec( Ka,Kb,Kc )

distan=zeros(89,1);

distMin=inf;

for i = 91:1:270
    
    
    j=(i) *pi/180 ;
    
    tB = [ sin(j) , -sin(3*j) ; -cos(j) , cos(3*j) ] \ [Kb*cos(3*j)-Ka*cos(j) ; Kb*sin(3*j)-Ka*sin(j)] ;
    tC = [ sin(j) , -cos(3*j) ; -cos(j) , sin(3*j) ] \ [Kc*sin(3*j)-Ka*cos(j) ; Kc*cos(3*j)-Ka*sin(j)] ;
    
    distan(i,1) = abs(tB(1)-tC(1)) ;
    
    
%         tB = Kb*sin(2*j)+(Kb*cos(2*j)-Ka)/tan(2*j) ;
%         tC = Kc*cos(2*j)+(Kc*sin(2*j)-Ka)*tan(2*j) ;
%     
%     distan(i,1) = abs(tB-tC) ;

    
    if distMin>distan(i)
        distMin = distan(i);
        theta = i;
    end
    
end

distanMaj=min(distan,1e-7);

figure
plot(distanMaj);

theta


end

